#ifndef __GAM_DATA_H__
#define __GAM_DATA_H__ 1

#include "fam.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct GAMReqData GAMReqData;
typedef GAMReqData *GAMReqDataPtr;
struct GAMReqData {
  int reqno;                  /* the request number */
  int state;      /* the request state */
  int type;                   /* the type of events */
  char *filename;   /* the filename needed for restarts */
  void *userData;             /* the user data if any */
};

typedef struct GAMData GAMData;
typedef GAMData *GAMDataPtr;

void    gamin_data_lock( GAMDataPtr data );
void    gamin_data_unlock( GAMDataPtr data );

GAMDataPtr  gamin_data_new( void );
void    gamin_data_free( GAMDataPtr conn );
int   gamin_data_reset( GAMDataPtr conn,
                        GAMReqDataPtr **requests );
int   gamin_data_get_data( GAMDataPtr conn,
                           char **data,
                           int *size );
int   gamin_data_get_reqnum( GAMDataPtr conn,
                             const char *filename,
                             int type,
                             void *userData );
int   gamin_data_get_request( GAMDataPtr conn,
                              const char *filename,
                              int type,
                              void *userData,
                              int reqno );
int   gamin_data_del_req( GAMDataPtr conn,
                          int reqno );
int   gamin_data_cancel( GAMDataPtr conn,
                         int reqno );
int   gamin_data_conn_data( GAMDataPtr conn,
                            int len );
int   gamin_data_need_auth( GAMDataPtr conn );
int   gamin_data_done_auth( GAMDataPtr conn );
int   gamin_data_read_event( GAMDataPtr conn,
                             FAMEvent *event );
int   gamin_data_event_ready( GAMDataPtr conn );
int   gamin_data_no_exists( GAMDataPtr conn );
int   gamin_data_get_exists( GAMDataPtr conn );

#ifdef __cplusplus
}
#endif

#endif
